package org.jeecg.enums.charge;

/**
 * 账单类型：0普通账单  1折扣账单
 */
public enum BillTypeEnum {
    BILL_TYPE_ORDINARY(0, "普通账单"),
    BILL_TYPE_REDUCED(1, "折扣账单"),
    ;

    private Integer code;
    private String desc;

    BillTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        if (value == null) return  "";
        BillTypeEnum[] enums = values();
        for (BillTypeEnum typeEnum : enums) {
            if (value.intValue()  == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        BillTypeEnum[] enums = values();
        for (BillTypeEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }
}
